﻿@{
    ViewBag.Title = "Customize";
}

@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>   
}

<div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;"> 
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <a class="mini-button" id="save" name="save" iconCls="icon-save" onclick="saveData" plain="true" visible="@ViewBag.save">保存</a>
                 <span class="separator"></span>
                <a class="mini-button" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
            </td>
        </tr>
    </table>       
</div>


<div class="mini-fit" >
    <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" 
        borderStyle="border:0;" showPager = "false" showPageSize="false" showPageIndex="false" 
        url="GetCustomize" allowCellSelect="true" allowCellEdit="true" showColumnsMenu="true" fitColumns="false"  
        oncellcommitedit="onCellCommitEdit">
        <div property="columns">
            <div type="checkboxcolumn" field="FUseFlag" name="FUseFlag" trueValue="1" falseValue="0" width="70" headerAlign="center">启用</div>
            <div field="FName" name="FName" width="200" headerAlign="center" align="center">支付名称
                <input property="editor" class="mini-textbox" />
            </div>
        </div>  
    </div>
</div>  

<script>
    mini.parse();
    var grid = mini.get("datagrid1");

    function FormShown() {  }

    load();

    function load() {
        grid.load({ json: parent.window.getSystemAppID() }, function (data) {            

        });
    }

    function saveData() {
        mini.get("save").setEnabled(false);
        var s = grid.getData();
        
        var mData = mini.encode(s);
        $.post("../Payment/SaveParam", { json: mData, mSystemAppID: parent.window.getSystemAppID() }, function (data) {
            var ret = mini.decode(data);
            if (ret.status == 1) {
                mini.showTips({ content: ret.msg, state: "success", x: "center", y: "top", timeout: 3000 });
            }
            else {
                mini.alert("异常:" + ret.error);
            }
            mini.get("save").setEnabled(true);
        });
    }

    function onCellCommitEdit(e) {
        mini.get("save").setEnabled(true); //编辑后保存按钮可用
    }
</script>